<?php
require_once 'models/models_baocao.php';
$obbc=new models_baocao();
$mod=$_GET['mod'];
switch ($mod)
{
	case 'doanhthu':{
		if(@$_POST['tungay'] && @$_POST['denngay']){
		$day=substr($_POST['tungay'],0,2);
		$mon=substr($_POST['tungay'],3,2);
		$year=substr($_POST['tungay'],6,4);
		$day1=substr($_POST['denngay'],0,2);
		$mon1=substr($_POST['denngay'],3,2);
		$year1=substr($_POST['denngay'],6,4);	
		if($mon==$mon1)
		{
			$data['listhd']=$obbc->_listhd($day, $mon, $year, $day1, $year1);
		}
		else {
			$data['listhd']=$obbc->listhd($day, $mon, $year, $day1, $mon1, $year1);
		}
		
			
		}
		$data['listcthd']=$obbc->listcthd();
		$data['listmh']=$obbc->listmh();
		$data['listkh']=$obbc->listkh();
		require_once 'views/admin/baocao/doanhthu.php';
		break;
	}
	case 'loinhuan':{
	if(@$_POST['tungay'] && @$_POST['denngay']){
		$day=substr($_POST['tungay'],0,2);
		$mon=substr($_POST['tungay'],3,2);
		$year=substr($_POST['tungay'],6,4);
		$day1=substr($_POST['denngay'],0,2);
		$mon1=substr($_POST['denngay'],3,2);
		$year1=substr($_POST['denngay'],6,4);	
		if($mon==$mon1)
		{
			$data['listhd']=$obbc->_listhd($day, $mon, $year, $day1, $year1);
		}
		else {
			$data['listhd']=$obbc->listhd($day, $mon, $year, $day1, $mon1, $year1);
		}
		
			
		}
		$data['listmh']=$obbc->listmh();
		$data['listctn']=$obbc->listctnhap();
		require_once 'views/admin/baocao/loinhuan.php';
		break;
	}
	
}